/*
 * Copyright (C) 2013 - present Instructure, Inc.
 *
 * This file is part of Canvas.
 *
 * Canvas is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, version 3 of the License.
 *
 * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */

@import "deprecated/bootstrap/mixins";
@import "vendor/bootstrap/button-groups";
@import "components/autocomplete";

#not_right_side,
.ic-Layout-contentWrapper,
.ic-Layout-contentMain,
.conversations {
  height: 100%;
}

.ic-Layout-wrapper {
  position: relative;
}

.ic-Layout-columns {
  position: absolute;
  top: 0; bottom: 0;
  margin-bottom: 0;
//  display: none;
  width: 100%;
}

#footer {
  display: none;
}

.ic-Layout-contentMain.ic-Layout-expand {
  overflow: visible;
  padding: 0;
}

.conversations {
  position: relative;
}

.conversations .panel {
  box-sizing: border-box;
  height: 58px;

  background: $lightBackground;
  border-bottom: 1px solid $ic-border-light;
  height: 112px;
  padding: $ic-sp;
  // TODO: revisit when breakpoint fixed
  // until we have a better breakpoint for desktop
  // need to put in direct amount for better ux
  @media only screen and (min-width: 1200px) {
    height: 62px;
    display: flex;
    align-items: center;
    padding-bottom: 0;
    padding-top: 0;
  }
  .panel__primary {
    margin-bottom: $ic-sp;
    // TODO: revisit when breakpoint fixed
    // until we have a better breakpoint for desktop
    // need to put in direct amount for better ux
    @media only screen and (min-width: 1200px) {
      margin-bottom: 0;
      flex: 1;
      white-space: nowrap;
    }
    > * {
      display: inline-block;
      white-space: nowrap;
    }
  }
  .panel__secondary {
    // TODO: revisit when breakpoint fixed
    // until we have a better breakpoint for desktop
    // need to put in direct amount for better ux
    @media only screen and (min-width: 1200px) { white-space: nowrap; }
    > div {
      display: inline-block;
      vertical-align: middle;
      white-space: nowrap;
    }
  }

  .btn.ui-state-active {
    background-color: #E6E6E6;
    background-image: none;
  }

  .actions {
    margin-right: $ic-sp;
  }
}

#sending-spinner {
  display: inline-block;
  height: 8px;
  width: 10px;
  vertical-align: bottom;
}

.filters {
  margin-right: $ic-sp;

  /* TODO: make sure we still need this with the frd filters (may not be selects) */
  select {
    margin-bottom: 0;
    width: 150px;
  }
}

.bootstrap-select abbr {
  cursor: pointer;
  border-bottom: none;
}

.conversations .panel, .message-header {
  button {
    &[disabled], &[disabled]:focus, &[disabled]:hover {
      color: #a6a6a6;
    }
  }

  .btn-group {
    display: inline-block;
  }
}

#help-btn {
  color: #333;
  position: relative;
  left: 8px;
  float: right;

  &:hover, &:focus {
    color: #0088cc;
    text-decoration: none;
  }

  .icon-mini-arrow-down {
    position: relative;
    right: 5px;
  }
}

.search .ac {
  display: block;

  .ac-input-box {
    float: left;
    min-height: 0;
    height: 38px;
    padding: 6px 12px;
    box-sizing: border-box;
    width: 205px;

    .ac-placeholder {
      top: 0;
      line-height: 38px;
    }

    .ac-clear {
      top: 8px;
    }
  }

  .ac-input {
    margin-left: 0;
  }

  input {
    border-radius: 0;
  }

  .btn {
    float: left;
  }
}

.messaging-wrapper {
  display: flex;
  position: absolute;
  bottom: 0;
  top: 112px;
  @media only screen and (min-width: 1200px) { top: 62px; }
}

.message-list-scroller {
  border-right: 1px solid #bfbfbf;
  height: 100%;
  overflow: auto;
  max-width: 400px;
}

.message-list {
  .list-header {
    color: darken($ic-color-neutral, 50);
    padding: 3px 12px;
    background: $lightBackground;
    border-bottom: 1px solid $ic-border-light;
  }

  .current-context-code {
    color: #f3f3f3;
    background-color: $ic-color-neutral;
    padding: 0 10px;
  }

  // individual message container
  .messages > li {
    background: $ic-color-light;
    box-sizing: border-box;
    cursor: pointer;
    height: 140px;
    padding: 20px 10px;
    border-bottom: 1px solid $ic-border-light;
    display: flex;

    &.active {
      background: $ic-bg-light-primary;
    }

    &:hover {
      box-shadow: inset -4px 0px 0px $ic-brand-primary;
    }

    .message-left-column {
      width: 25px;
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .message-middle-column {
      flex-grow: 1;
      padding: 0 10px;
    }

    .message-right-column {
      width: 25px;
      display: flex;
      justify-content: space-between;
      flex-direction: column;
      align-items: center;
    }

    &.active, &:hover {
      .star-btn {
        transform: translateX(0);
      }
    }
  }

  .date {
    color: $ic-brand-primary;
    @include fontSize(13px);
    margin-bottom: 10px;
  }

  .author {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    @include fontSize(14px);
    font-weight: bold;
    margin: 0;
    color: $ic-color-dark;
  }

  .subject {
    @include fontSize(16px);
    color: $ic-color-medium-darker;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: normal;
    margin: 0;

    &:focus {
      outline: 0;
    }
  }

  .summary {
    @include fontSize(16px);
    color: $ic-color-medium;
    height: 40px;
    margin: 0 24px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .message-count {
    @include fontSize(13px);
    background-color: $ic-color-dark;
    padding: 4px 7px;
    border-radius: 4px;
    text-shadow: none;
  }

  .select-checkbox {
    position: relative;
    left: 5px;
    margin-bottom: 8px;
    top: -2px;
  }

  .read-state {
    border-radius: 50%;
    box-sizing: border-box;
    display: inline-block;
    margin: 3px;
    height: 16px;
    width: 16px;
    background: $ic-brand-primary;
    box-shadow: none;

    &:focus {
      outline: none;
    }

    &.read {
      box-shadow: 0 0 0 1px #A5AFB5;
      background: none;
    }
  }

  .star-btn {
    color: $ic-color-medium-darker;
    display: inline-block;
    font-family: 'Hiragino Kaku Gothic Pro', 'Lucida Sans Unicode', 'Arial Unicode MS';
    @include fontSize($ic-font-size--medium);
    transform: translateX(50px);
    text-decoration: none;

    &:focus, &.active {
      transform: translateX(0);
    }

    &:before {
      content: '\2606';
    }

    &.active {
      color: $ic-color-alert;
      text-shadow: 0 0 1px $ic-color-alert;
      &:before {
        content: '\2605';
      }
    }
  }

  p {
    @include fontSize($ic-font-size--xsmall);
    line-height: 16px;
    margin-bottom: 8px;
  }
}

.open-message {
  @include accessibility-prompt;
  left: -9999px;
  position: absolute;
  &:focus {
    left: auto; top: auto;
    right: 0; bottom: 0;
    z-index: 1;
    width: auto; height: auto;
  }
}

.message-detail.span8 {
  margin-left: 0;
  width: 68.08511%;
  height: 100%;
  overflow: auto;
  flex-grow: 1;

  &:focus {
    outline: none;
  }

  .subject {
    float: left;
  }

  .no-messages {
    color: #bbbbbb;
    display: block;
    @include fontSize(20px);
    font-weight: bold;
    margin-top: 5%;
    text-align: center;

    i {
      display: block;
      line-height: 120px;
      margin-bottom: 120px;
      text-align: center;
      width: 100%;

      &:before {
        @include fontSize(120px);
      }
    }
  }

  .message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
    padding: 0 12px;
    border-bottom: 1px solid $ic-border-light;

    .label {
      margin-top: 12px;
    }
  }

  .message-detail-actions {
    li {
      display: inline;
    }
  }

  .message-content > li {
    margin: 0 12px;
    padding: 24px 0;
    border-bottom: 1px solid $ic-border-light;

    p:last-child {
      margin-bottom: 0;
    }

    .message-attachments {
      list-style: none;
      margin: 0 1em;
      padding: 0.5em;
      border-top: 1px solid $ic-border-light;
    }

    .message-attachment-thumbnail {
      max-height: 16px;
      max-width: 16px;
    }
  }

  .message-info {
    margin-bottom: $ic-sp;
  }

  .user-info {
    .avatar {
      float: left;
      margin-right: 8px;
    }

    .context {
      color: darken($ic-color-neutral, 50);
      display: block;
    }

    .message-author-and-participants {
      padding-top: 6px;
    }
  }

  .message-metadata {
    position: relative;
  }

  .date {
    color: darken($ic-color-neutral, 50);
    position: absolute;
    right: 10px;
    top: 0;
  }

  .actions {
    right: 9999em;
    position: relative;
    top: 0;
    margin: 20px 10px 0 8px;
  }

  .actions li {
    border: none;
    float: left;
    margin:0 0 0 8px;
    padding: 0;
  }

  .message-detail-actions li a,
  .actions li a {
    color: darken($ic-color-neutral, 50);

    &:hover, &:focus {
      color: #333;
      outline: none;
      text-decoration: none;
    }
  }
}

.touch .message-detail .actions {
  right: -7px;
  top: 24px;
}

.touch .message-item-view:hover, .touch .message-metadata.hover {
  .date {
    right: 0;
  }
}

.message-item-view:hover, .message-metadata.hover {

  .actions {
    display: block;
    right: -7px;
  }
}

.bootstrap-select.btn-group, .bootstrap-select.btn-group[class*="span"] {
  margin-bottom: 0;
}

i.icon-ok:before {
  vertical-align: baseline;
}

.bootstrap-select .dropdown-submenu > .dropdown-menu {
  top: -20px;
}

.bootstrap-select .dropdown-submenu .dropdown-menu.inner {
  max-height: 200px;
  overflow: auto;
}

.bootstrap-select label {
  margin: 0;
  display: block;
}

input.dropdown-search {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 90%;
}

.message-header-row .ac-input-box {
  max-height: 95px;
  overflow-y: auto;
}

.beta-notice {
  margin: 36px 48px;
}
